<template>
	<view class="content">
		<view class="logo-parent">
			<view class="logo-back"></view>
			<view class="titlebar"></view>
		</view>
		<!-- <view class="text-area" > -->
		<view style="display: flex;">
			<button class="title" type="warn" plain :style="{transform: coverTransform}" @touchstart="start"
			 @touchmove.stop.prevent="ing" @touchend="end"  @tap="click4">{{title}}</button>
			<button class="title" type="primary" :style="{transform: coverTransformm}" @touchstart="startt" @touchmove.stop.prevent="ingg"
			 @touchend="endd" plain  @tap="click5">{{title}}</button>

		</view>
		<view style="display: block;">
			<button type="default" plain @tap="click1">点击</button>
			<button type="primary" @tap="click2">点击</button>
			<button type="warn" @tap="click3">点击</button>
			<button type="warn" disabled="true">点击</button>
		</view>
		<!-- </view> -->
	</view>
</template>

<script>
	import ssss from '../../components/uni-aaaa/uni-aaaa.vue'
	const {
		windowWidth,
		windowHeight
	} = uni.getSystemInfoSync();
	export default {
		data() {
			return {
				title: 'Hello',
				setitle: 'Hello',
				coverTransform: 'translate(0px,0px)',
				startX: 0,
				startY: 0,
				fangWidth: '100px',
				startXX: 0,
				startYY: 0,
				coverTransformm: 'translate(0px,0px)',
			}
		},
		created() {

		},
		onLoad() {
			this.fangWidth = (windowWidth - 50) / 4 + 'px';

		},
		methods: {
			start(e) {
				this.startX = e.touches[0].clientX;
				this.startY = e.touches[0].clientY;
			},
			ing(e) {
				var moveDistanceX = e.touches[0].clientX - this.startX;
				var moveDistanceY = e.touches[0].clientY - this.startY;
				this.coverTransform = `translate(${moveDistanceX}px,${moveDistanceY}px)`;
			},
			end(e) {
				this.coverTransform = 'translate(0px,0px)';
			},
			startt(e) {
				this.startXX = e.touches[0].clientX;
				this.startYY = e.touches[0].clientY;
			},
			ingg(e) {
				var moveDistanceX = e.touches[0].clientX - this.startXX;
				var moveDistanceY = e.touches[0].clientY - this.startYY;
				this.coverTransformm = `translate(${moveDistanceX}px,${moveDistanceY}px)`;
			},
			endd(e) {
				this.coverTransformm = 'translate(0px,0px)';
			},
			click1() {
				uni.showLoading({
					title:"加载中",
					success() {
						setTimeout(function() {
							uni.hideLoading();
						}, 3000)
					}
				})
			},
			click2() {
				uni.showToast({
					duration: 3000,
					title: "点一下3秒消失"
					// icon:success,loading,none
				})
			},
			click4() {
				uni.showToast({
					duration: 1000,
					title: "Hello",
					icon:"loading"
				})
			},
			click5() {
				uni.showToast({
					duration: 1000,
					title: "Hello",
					icon:"none"
				})
			},
			click3() {
				uni.showModal({
					title: '标题',
					content: '内容',
					success(res) {
						if (res.confirm) {
							uni.showToast({
								duration: 1000,
								title: "点了确定"
							})
						} else {
							uni.showToast({
								duration: 1000,
								title: "点了取消"
							})
						}

					}
				})
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
	}

	.logo-parent {
		position: relative;
	}

	.titlebar {
		height: 50rpx;
	}

	.logo-back {
		width: 100%;
		height: 400rpx;
		background-color: #C8C7CC;
		position: absolute;
	}

	.logo-view {
		padding: 20rpx;
		margin-top: 30rpx;
	}

	.logo {
		height: 350rpx;
		width: 100%;
	}

	.text-area {
		display: flex;
		justify-content: center;
		/* transition: transform .1s linear; */
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}

	.fang {
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		transform: rotate(0deg) scale(1);
		-webkit-transform: rotate(0deg) scale(1);
	}

	.fang:hover {
		transform: rotate(15deg) scale(1.1);
		-webkit-transform: rotate(15deg) scale(1.1);
	}
</style>
